package counter.until;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class Sessionservlet2 {

	public static void doSession(HttpServletRequest request) {
		HttpSession session = request.getSession();
//		Object obj = session.getAttribute("counter");
//		int count;
//		if(obj == null){
//			session.setAttribute("counter",1);
//		}else{
//			count = (Integer)session.getAttribute("counter");
//			count++;
//			session.setAttribute("counter",count);
//		}
//		
		
		int count;
		if(session.getAttribute("counter") == null){
			session.setAttribute("counter",1);
		}else{
			count = (Integer)session.getAttribute("counter");
			count++;
			session.setAttribute("counter",count);
		}
		
	}
	}

